﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using SQLHelper;

public partial class front_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        bind();
    }

    void bind()
    {
        string sql = "select top 4 id,title,column_name,source,created_at from news where column_name = '科技时事'";
        DataSet res = DB.GetDataWithQuerySecond(sql, "news");
        DataList1.DataSource = res;
        DataList1.DataBind();
        DB.ColseSqlCon();

        string sql1 = "select top 4 id,title,column_name,source,created_at from news where column_name = '人工智能'";
        DataSet res1 = DB.GetDataWithQuerySecond(sql1, "news");
        DataList2.DataSource = res1;
        DataList2.DataBind();
        DB.ColseSqlCon();

        string sql2 = "select top 2 id,title,column_name,source,created_at from news where column_name = '互联网'";
        DataSet res2 = DB.GetDataWithQuerySecond(sql2, "news");
        DataList3.DataSource = res2;
        DataList3.DataBind();
        DB.ColseSqlCon();

        string sql3 = "select top 2 id,title,column_name,source,created_at from news where column_name = '虚拟现实'";
        DataSet res3 = DB.GetDataWithQuerySecond(sql3, "news");
        DataList4.DataSource = res3;
        DataList4.DataBind();
        DB.ColseSqlCon();
    }
}